<template>
	<view :class="['guide', { 'animation-reverse': true, 'animation-scale-down': show  }]">
		<view class="btn timer" @tap="Jump">
			<view class="info">跳过</view>
			<view class="circleProgress_wrapper btn">
				<view class="wrapper right">
					<view class="circleProgress rightcircle"></view>
				</view>
				<view class="wrapper left">
					<view class="circleProgress leftcircle" @animationend="Jump"></view>
				</view>
			</view>
		</view>	
		<image :src="source.img.url"></image>
	</view>
</template>

<script>
	import { mapGetters } from 'vuex'
	export default {
		props: {
			source: Object
		},
		data () {
			return {
				show: false
			}
		},
		created() {
			this.checkFlag()
		},
		methods: {
			Jump () {
				this.show = true
				setTimeout(() => {
				   uni.showTabBar({ animation: true })	
				   this.$emit('welcome', false)
				}, 650)
			},
			checkFlag () {
				try {
				    const value = uni.getStorageSync('launchFlag')
					uni.hideTabBar()					
				    if (!value) {
				        uni.setStorage({
				            key: 'launchFlag',
				            data: true
				        })
				    }
				} catch(e) { 
					uni.hideTabBar()
					uni.setStorage({ 
						key: 'launchFlag', 
						data: true
					})
				}
			}
		}
	}
</script>
<style lang="less">
@import '../../../common/styles/variables.less';
@keyframes scale {
	from {
		transform: scale(1)
	}
	to {
		transform: scale(1.1)
	}
}
@-webkit-keyframes scale {
	from {
		transform: scale(1)
	}
	to {
		transform: scale(1.1)
	}
}
.guide {
	height: 100%;
	overflow: hidden;
	image {
		width: 100%;
		height: 100%;
		overflow: hidden;
		animation: scale 4s linear forwards
	}
	view {
		box-sizing: initial
	}
.timer {
	display: inline-block;
	position: fixed;
	top: 80upx;
	/* #ifdef MP-WEIXIN */
	top: 120upx;
	/* #endif */
	right: 20px;
	z-index: 99
}

.info {
	position: absolute;
	top: 0;
	left: 0;
	width: 36px;
	height: 36px;
	line-height: 36px;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.3);
	text-align: center;
	color: #FFFFFF;
	font-size: 12px;
}
	
.circleProgress_wrapper {
	width: 36px;
	height: 36px;
	position: relative;
}

.wrapper {
	width: 18px;
	height: 36px;
	position: absolute;
	top: 0;
	overflow: hidden;
}

.right {
	right: 0;
}

.left {
	left: 0;
}

.circleProgress {
	width: 32px;
	height: 32px;
	border: 2px solid #FFFFFF;
	border-radius: 50%;
	position: absolute;
	top: 0;
	-webkit-transform: rotate(45deg);
}

.rightcircle {
	border-top: 2px solid #03A9F4;
	border-right: 2px solid #03A9F4;
	right: 0;
	-webkit-animation: circleProgressLoad_right 4s linear;
	/*动画停留在最后一帧*/
	animation-fill-mode: forwards;
	-moz-animation-fill-mode: forwards;
	-webkit-animation-fill-mode: forwards;
	-o-animation-fill-mode: forwards;
}

.leftcircle {
	border-bottom: 2px solid #03A9F4;
	border-left: 2px solid #03A9F4;
	left: 0;
	-webkit-animation: circleProgressLoad_left 4s linear;
	/*动画停留在最后一帧*/
	animation-fill-mode: forwards;
	-moz-animation-fill-mode: forwards;
	-webkit-animation-fill-mode: forwards;
	-o-animation-fill-mode: forwards;
}

@-webkit-keyframes circleProgressLoad_right {
	0% {
		border-top: 2px solid #03A9F4;
		border-right: 2px solid #03A9F4;
		-webkit-transform: rotate(45deg);
	}

	50% {
		border-top: 2px solid #03A9F4;
		border-right: 2px solid #03A9F4;
		border-left: 2px solid #FFFFFF;
		border-bottom: 2px solid #FFFFFF;
		-webkit-transform: rotate(225deg);
	}

	100% {
		border-left: 2px solid #FFFFFF;
		border-bottom: 2px solid #FFFFFF;
		-webkit-transform: rotate(225deg);
	}
}

@-webkit-keyframes circleProgressLoad_left {
	0% {
		border-bottom: 2px solid #03A9F4;
		border-left: 2px solid #03A9F4;
		-webkit-transform: rotate(45deg);
	}

	50% {
		border-bottom: 2px solid #03A9F4;
		border-left: 2px solid #03A9F4;
		border-top: 2px solid #FFFFFF;
		border-right: 2px solid #FFFFFF;
		-webkit-transform: rotate(45deg);
	}

	100% {
		border-top: 2px solid #FFFFFF;
		border-right: 2px solid #FFFFFF;
		-webkit-transform: rotate(225deg);
	}
}
	
}
</style>
